package com.zboot.zbootadmin.project.system.log.controller;


import com.zboot.zbootadmin.common.annotation.Log;
import com.zboot.zbootadmin.common.constant.HttpStatus;
import com.zboot.zbootadmin.common.domain.ResponseData;
import com.zboot.zbootadmin.project.system.log.entity.dto.LogDto;
import com.zboot.zbootadmin.project.system.log.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 日志表 前端控制器
 * </p>
 *
 * @author zyt
 * @since 2020-10-12
 */
@RestController
@RequestMapping("/sysLog")
public class SysLogController {

    @Autowired
    private SysLogService sysLogService;

    @Log("获取日志列表")
    @PreAuthorize("@zboot.hasPermi('sys:log:operlist')")
    @PostMapping("/getLogList")
    public ResponseData getLogList(@RequestBody LogDto logDto) {
        return new ResponseData(HttpStatus.SUCCESS,sysLogService.getLogList(logDto));
    }

    @Log("查看日志")
    @PreAuthorize("@zboot.hasPermi('sys:log:operlook')")
    @GetMapping("/showLogDetail/{id}")
    public ResponseData showLogDetail( @PathVariable("id") String id) {
        return new ResponseData(HttpStatus.SUCCESS,sysLogService.getById(id));
    }
}

